////
////  SettingPageVM.swift
////  chat
////
////  Created by 1 on 2023/6/25.
////
//
//import Foundation
//import ObjectMapper
//
//class SettingPageVM: BaseVM<StatusModel>{
//
//    @Published var userinfo:UserModel = Mapper<UserModel>().map(JSON: ["error":"无初始化"])!
//    @Published var user_sexString:String = "保密"
//    @Published var mobileBind:Bool = false
//    
//    // 获取数据
//    func fetchData(completion: @escaping () -> Void) {
//        if(isLogin){//已登录
//            self.userinfo = AIUserAccount.userInfo ?? Mapper<UserModel>().map(JSON: ["error":"无初始化"])!
//            self.user_sexString = self.userinfo.user_sexString
//            AIService.actionUserGetuserinfo { bean in
//                self.userinfo = bean
//                self.user_sexString = self.userinfo.user_sexString
//                self.mobileBind = self.userinfo.mobileBind
//            } failure: { error in
//                
//            }
//        }else{
//            self.userinfo = Mapper<UserModel>().map(JSON: ["error":"无初始化"])!
//        }
//    }
//    
//    override func appear() {
//        super.appear()
//        fetchData {
//            
//        }
//    }
//    
//    func updateUserInfoSex(){
//        if(user_sexString == AIUserAccount.userInfo?.user_sexString){
//            return
//        }
//        var sex = "0"
//        if("保密" == user_sexString){
//            sex = "0"
//        }else if("男" == user_sexString){
//            sex = "1"
//        }else if("女" == user_sexString){
//            sex = "2"
//        }
//        AIService.actionUpdateuserinfo(sex: sex) { bean in
//            let userInfo = AIUserAccount.userInfo!
//            userInfo.user_sex = sex
//            AIUserAccount.saveUserInfo(userInfo: userInfo)
//            MBAToast.show(text: "保存成功")
//            self.userinfo = userInfo
//        } failure: { error in
//            
//        }
//    }
//}
